cmake_minimum_required(VERSION 3.18.1)


project("icanlive")


include_directories(${CMAKE_SOURCE_DIR}/myLibs/include)


add_library(avfilter SHARED IMPORTED)
set_target_properties(avfilter PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/myLibs/${CMAKE_ANDROID_ARCH_ABI}/libavfilter.so)

add_library(avformat SHARED IMPORTED)
set_target_properties(avformat PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/myLibs/${CMAKE_ANDROID_ARCH_ABI}/libavformat.so)

add_library(avcodec SHARED IMPORTED)
set_target_properties(avcodec PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/myLibs/${CMAKE_ANDROID_ARCH_ABI}/libavcodec.so)

add_library(avutil SHARED IMPORTED)
set_target_properties(avutil PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/myLibs/${CMAKE_ANDROID_ARCH_ABI}/libavutil.so)

add_library(swresample SHARED IMPORTED)
set_target_properties(swresample PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/myLibs/${CMAKE_ANDROID_ARCH_ABI}/libswresample.so)

add_library(swscale SHARED IMPORTED)
set_target_properties(swscale PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/myLibs/${CMAKE_ANDROID_ARCH_ABI}/libswscale.so)

add_library(rtmp STATIC IMPORTED)
set_target_properties(rtmp PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/myLibs/${CMAKE_ANDROID_ARCH_ABI}/librtmp.a)

#aux_source_directory(. SOURCE)
#
#add_library(
#        icanlive
#        SHARED
#        ${SOURCE})

add_library(
        icanlive
        SHARED
        native-lib.cpp
        ICanPlayer.h
        ICanPlayer.cpp
        JavaCallHelper.h
        JavaCallHelper.cpp
        Log.h
        SafeQueue.h
        BasePlayer.h
        BasePlayer.cpp
        VideoPlayer.h
        VideoPlayer.cpp
        AudioPlayer.h
        AudioPlayer.cpp
)


find_library(
        log-lib
        log)

target_link_libraries(
        icanlive
        #        avcodec
        #        avfilter
        #        avformat
        #        avutil
        #        swresample
        #        swscale
        #        rtmp
        #        z
        avfilter avformat avcodec avutil swresample swscale rtmp z OpenSLES android
        ${log-lib})